package Geometry;

import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PointF;
import android.graphics.Paint.Style;

public class Circle extends Picture {

	private float radius;
	
	
	
	public Circle(int drawColor, PointF basePoint, float radius) {
		super(drawColor, basePoint);
		this.radius = radius;
	}



	/**
	 * @return the radius
	 */
	public float getRadius() {
		return radius;
	}



	/**
	 * @param radius the radius to set
	 */
	public void setRadius(float radius) {
		this.radius = radius;
	}



	@Override
	public void draw(Canvas canv) {
		Paint p = new Paint();
		p.setColor(getDrawColor());
		p.setStyle(Style.FILL);
		canv.drawCircle(getBasePoint().x, getBasePoint().y, radius, p);
	}



	/**
	 *  The point (x,y) is inside this circle if the distance of (x,y)
	 *  	from the center is less than the radius.
	 */
	@Override
	public boolean isInside(float x, float y) {
		double dist = Math.hypot(x-getBasePoint().x, y-getBasePoint().y);
		return dist < radius;
	}
	
	

}
